<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<style type="text/css">
	td{
		text-align: left;
	}
</style>
<table border="1" cellspacing="0" width="100%" class="table table-bordered">
	<thead>
		<tr>
			<th style="width: 50px;">序号</th>
			<th style="width: 128px;">操作</th><#list table.fields as field>
			<th><#if field.comment??>${field.comment}<#else>${field.propertyName}</#if></th></#list>
		</tr>
	</thead>
	<tbody id="columnList" align="center">
		<c:forEach items="${r'$'}{${vo?uncap_first}Page.list}" var="data" varStatus="i">
			<tr>
				<td>${r'$'}{(${vo?uncap_first}Page.pageNum - 1) * ${vo?uncap_first}Page.pageSize + i.index + 1}</td>
				<td>
					<a href="javascript:" style="padding: 0 5px" onclick="view${vo}('${r'$'}{data.<#list table.fields as field><#if field.keyFlag>${field.propertyName}</#if></#list>}')">编辑</a>
					<a href="javascript:" style="padding: 0 5px" onclick="delete${vo}('${r'$'}{data.<#list table.fields as field><#if field.keyFlag>${field.propertyName}</#if></#list>}')">删除</a>
				</td>
				<#list table.fields as field>
				<td><#if field.type == 'date'><fmt:formatDate value="${r'$'}{data.${field.propertyName}}" pattern="yyyy-MM-dd"/><#elseif field.type == 'datetime' || field.type == 'timestamp'><fmt:formatDate value="${r'$'}{data.${field.propertyName}}" pattern="yyyy-MM-dd HH:mm:ss"/><#else>${r'$'}{data.${field.propertyName}}</#if></td>
				</#list>
			</tr>
		</c:forEach>
	</tbody>
</table>
<div class="wrap page-wrap" style="text-align: center">
	<div class="tcdPageCode" id="${vo?uncap_first}PageCode"></div>
</div>
<link rel="stylesheet" type="text/css" href="${r'$'}{ctx}/static/plugin/page/css/jqueryPage.min.css"/>
<script type="text/javascript" src="${r'$'}{ctx}/static/plugin/page/js/jquery.page.min.js"></script>
<script type="text/javascript">
	$(function () {
		$("#${vo?uncap_first}PageCode").createPage({
			pageCount: ${r'$'}{${vo?uncap_first}Page.pages},
			${r'current'}: ${r'$'}{${vo?uncap_first}Page.pageNum},
			${r'totalRows'}: ${r'$'}{${vo?uncap_first}Page.total},
			backFn: function(p) {
				//请求当前页p
				get${vo}s(p);
			}
		})
	});
	function view${vo}(<#list table.fields as field><#if field.keyFlag>${field.propertyName}</#if></#list>) {
		loadOther("${r'$'}{ctx}<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.voPath}</#if>/view.action?<#list table.fields as field><#if field.keyFlag>${field.propertyName}</#if></#list>="+<#list table.fields as field><#if field.keyFlag>${field.propertyName}</#if></#list>);
	}
	function ${r'delete'}${vo}(<#list table.fields as field><#if field.keyFlag>${field.propertyName}</#if></#list>) {
        bootbox.confirm("是否确认删除",function(result){
            if(result){
                $.post("${r'$'}{ctx}<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.voPath}</#if>/delete.action?<#list table.fields as field><#if field.keyFlag>${field.propertyName}</#if></#list>="+<#list table.fields as field><#if field.keyFlag>${field.propertyName}</#if></#list>, function () {
					get${vo}s()
                });
            }
        });
	}
</script>